package com.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.common.Result;
import com.pojo.entity.Goods;
import com.pojo.entity.Store;
import com.service.IStoreService;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author : 杨世博
 * @date: Created in 11:54 2023/6/9
 */
@RestController
@RequestMapping("/store")
@Api(tags = "商家接口")
@Slf4j
public class StoreController {
    @Autowired
    IStoreService storeService;

    @PostMapping("/getGoodsInShop")
    public Result<IPage<Goods>> getGoodsInShop(@RequestParam("uid")Integer uid,
                                              @RequestParam(value = "key", required = false)String key,
                                              @RequestParam("pageNum")Integer pageNum,
                                              @RequestParam("size")Integer size){
        IPage<Goods> goods = storeService.getGoodsInShop(uid, key, pageNum, size);
        return Result.success(goods);
    }
}
